package com.example.userconsumer.controller;


import com.jbf.pojo.User;
import com.jbf.service.CountService;
import com.jbf.service.MyService;
import com.jbf.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController

public class UserController {

    @Reference
    private UserService userService;

    @Reference
    private MyService myService;

    @Reference
    private CountService countService;

    @GetMapping("/findUser")
    public List<User> getUserList(){
        return userService.findAllUser();
    }

    @GetMapping("/findUserByName/{name}")
    public List<User> getUserListByName(@PathVariable("name") String name){
        return myService.findUserByName(name);
    }

    @GetMapping("/countUser")
    public int getUserCount(){
        return countService.countUser();
    }
}
